name_list=["张宇","宋祖"]
while True:
    name=input("请输入购买火车票的用户姓名：(Q/q退出)")
    if name.upper()=="Q":
        break
    if name.startswith("刁"):
        name_list.insert(-1,name)
    else:
        name_list.append(name)
print(name_list)